import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_ducafecat_news/base/base_mvp_presenter.dart';
import 'package:flutter_ducafecat_news/common/utils/utils.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_ducafecat_news/base/base_mvp_view.dart';
import 'package:flutter_ducafecat_news/base/base_mvp_widget.dart';

class MyCenterPage extends BaseWidget {
  @override
  BaseWidgetState<BasePresenter<BaseMvpView>, BaseWidget> getState() {
    // TODO: implement getState
    return _myCenterPageState();
  }
}

class _myCenterPageState extends BaseWidgetState {
  @override
  Widget buildWidget(BuildContext context) {
    // TODO: implement buildWidget
    return Container(
      child: Column(
        children: <Widget>[
          _buildTopView(),
          SizedBox(
            height: 20.h,
          ),
          _buildPosition()
        ],
      ),
    );
  }

  Widget _buildTopView() {
    return Container(
      height: 340.h,
      child: Stack(
        children: <Widget>[
          Positioned(
              child: Container(
            decoration: BoxDecoration(
                gradient: LinearGradient(
                    colors: [Color(0xffDE3628), Color(0xffF1891A)])),
            padding: EdgeInsets.all(30.w),
            height: 240.h,
            child: Row(
              mainAxisAlignment: MainAxisAlignment.start,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Container(
                  child: ClipOval(
                    child: Image.network(
                      "http://www.ionic.wang/statics/index/images/ionic4.png",
                      width: 120.w,
                      height: 120.w,
                      fit: BoxFit.cover,
                    ),
                  ),
                  margin: EdgeInsets.only(top: 0),
                ),
                SizedBox(
                  width: 20.w,
                ),
                Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: <Widget>[
                    Text(
                      "1820****879",
                      textAlign: TextAlign.left,
                      style: TextStyle(color: Colors.white, fontSize: 36.sp),
                    ),
                    SizedBox(
                      height: 20.h,
                    ),
                    Text(
                      "这是您使用四通易达的第1001天",
                      style: TextStyle(color: Colors.white, fontSize: 22.sp),
                    )
                  ],
                ),
                Spacer(),
                Image.asset(
                  'assets/images/home-def-sell.png',
                  width: 52.sp,
                  height: 52.sp,
                )
              ],
            ),
          )),
          Positioned(
            bottom: 0,
            left: 0,
            right: 0,
            child: Container(
                height: 180.h,
                margin: EdgeInsets.only(left: 24.w, right: 24.w),
                decoration: BoxDecoration(
                    color: Colors.white,
                    borderRadius: BorderRadius.circular(12.w)),
                padding: EdgeInsets.only(top: 35.h, bottom: 20.h),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceAround,
                  children: <Widget>[
                    Column(
                      children: <Widget>[
                        Image.asset(
                          'assets/images/home-def-sell.png',
                          width: 80.w,
                          height: 80.w,
                        ),
                        SizedBox(
                          height: 8.h,
                        ),
                        Text(
                          "地址簿",
                          style: TextStyle(
                              color: Color(0xFF666666), fontSize: 24.sp),
                        )
                      ],
                    ),
                    Column(
                      children: <Widget>[
                        Image.asset(
                          'assets/images/home-def-sell.png',
                          width: 80.w,
                          height: 80.w,
                        ),
                        SizedBox(
                          height: 8.h,
                        ),
                        Text(
                          "地址簿",
                          style: TextStyle(
                              color: Color(0xFF666666), fontSize: 24.sp),
                        )
                      ],
                    ),
                    Column(
                      children: <Widget>[
                        Image.asset(
                          'assets/images/home-def-sell.png',
                          width: 80.w,
                          height: 80.w,
                        ),
                        SizedBox(
                          height: 8.h,
                        ),
                        Text(
                          "地址簿",
                          style: TextStyle(
                              color: Color(0xFF666666), fontSize: 24.sp),
                        )
                      ],
                    )
                  ],
                )),
          )
        ],
      ),
    );
  }

  Widget _buildTopItemsView() {
    return Container(
        margin: EdgeInsets.only(left: 24.w, right: 24.w),
        decoration: BoxDecoration(
            color: Colors.white, borderRadius: BorderRadius.circular(12.w)),
        padding: EdgeInsets.only(top: 40.h, bottom: 40.h),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          children: <Widget>[
            Column(
              children: <Widget>[
                Image.asset(
                  'assets/images/home-def-sell.png',
                  width: 80.w,
                  height: 80.w,
                ),
                SizedBox(
                  height: 8.h,
                ),
                Text(
                  "地址簿",
                  style: TextStyle(color: Color(0xFFDE3628), fontSize: 24.sp),
                )
              ],
            ),
            Column(
              children: <Widget>[
                Image.asset(
                  'assets/images/home-def-sell.png',
                  width: 80.w,
                  height: 80.w,
                ),
                SizedBox(
                  height: 8.h,
                ),
                Text(
                  "地址簿",
                  style: TextStyle(color: Color(0xFFDE3628), fontSize: 24.sp),
                )
              ],
            ),
            Column(
              children: <Widget>[
                Image.asset(
                  'assets/images/home-def-sell.png',
                  width: 80.w,
                  height: 80.w,
                ),
                SizedBox(
                  height: 8.h,
                ),
                Text(
                  "地址簿",
                  style: TextStyle(color: Color(0xFFDE3628), fontSize: 24.sp),
                )
              ],
            )
          ],
        ));
  }

  Widget _buildPosition() {
    return InkWell(
      onTap: null,
      child: Container(
        decoration: BoxDecoration(color: Colors.white),
        padding: EdgeInsets.all(30.w),
        child: Row(
          children: <Widget>[
            Image.asset(
              'assets/images/home-def-sell.png',
              width: 40.w,
              height: 40.w,
            ),
            SizedBox(
              width: 13.w,
            ),
            Text(
              "帮助中心",
              style: TextStyle(color: Color(0xFF333333), fontSize: 28.sp),
            ),
            Spacer(),
            Icon(Icons.arrow_forward_ios)
          ],
        ),
      ),
    );
  }

  @override
  void initData() {
    // TODO: implement initData
    setAppBarText("我的");
    setOtherHeight(getBottomNavigationBarHeight(context));
  }

  @override
  BasePresenter<BaseMvpView> initPresenter() {
    // TODO: implement initPresenter
    return null;
  }

  @override
  void showSuccess(data) {
    // TODO: implement showSuccess
  }
}
